package com.xique.door.service.impl.estate;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xique.common.core.utils.StringUtils;
import com.xique.door.bean.domain.estate.EstateUserBuilding;
import com.xique.door.mapper.estate.EstateUserBuildingMapper;
import com.xique.door.service.estate.IEstateUserBuildingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author shd
 * @create 2022/6/9 16:06
 */
@Service
public class EstateUserBuildingServiceImpl extends ServiceImpl<EstateUserBuildingMapper, EstateUserBuilding> implements IEstateUserBuildingService {

    @Autowired
    private EstateUserBuildingMapper estateUserBuildingMapper;

    @Override
    public List<EstateUserBuilding> listByUserId(Long userId) {
        if (StringUtils.isNull(userId)) {
            return new ArrayList<>();
        }
        LambdaQueryWrapper<EstateUserBuilding> condition = Wrappers.lambdaQuery();
        condition.eq(EstateUserBuilding::getUserId, userId);
        return estateUserBuildingMapper.selectList(condition);
    }
}
